use([
    "public/javascripts/service/paymentService.js",
    "public/javascripts/widget/pay/pay.js",
    "public/javascripts/widget/slider/slider.js",
    "public/common/classNames.js"
], function(paymentService, PayComponent, SliderComponent, classNames) {
    var cn = classNames;
    var PageComponent = React.createClass({
        componentDidMount: function() {

        },
        receiveMsg: function(data) {
            if(data.change === 'banks') {
                this.state.data.banks = data.data;
            }else if(data.change === 'platform'){
                this.state.data.platform = data.data;
            }
            this.setState();
        },
        getInitialState: function () {
            return this.props ? this.props : {};
        },
        closeQrcode: function() {
            $('body').css({'overflow':'auto', 'height':'auto'});
            $(".layer-cover").hide();
            $("#qrcode").empty();
        },
        confirmPayment: function(done) {
            eventFlux.call('widget_pay_Event', 'getData', function(data){
                if(data.active === 3 && data.platform[0].value){
                    $('body').css({'overflow':'hidden', 'height':'100%'});
                    $(".layer-cover").show();
                }
                easyMe.useJs(['lib/qrcode.js']);
                var qrcode = new QRCode('qrcode', {
                    width: 214,
                    height: 214,
                    text: 'https://www.baidu.com',
                });
            });
        },
        render:function() {
            this.state.data.banks = [
                {
                    id: 1,
                    value: true,
                    name: '中信银行'
                },
                {
                    id: 2,
                    value: false,
                    name: '中国工商银行'
                },
                {
                    id: 3,
                    value: false,
                    name: '中国建设银行'
                },
                {
                    id: 4,
                    value: false,
                    name: '华夏银行'
                },
                {
                    id: 5,
                    value: false,
                    name: '中国农业银行'
                },
                {
                    id: 6,
                    value: false,
                    name: '兴业银行'
                },
                {
                    id: 7,
                    value: false,
                    name: '中国银行'
                },
                {
                    id: 8,
                    value: false,
                    name: '中国民生银行'
                },
                {
                    id: 9,
                    value: false,
                    name: '交通银行'
                },
                {
                    id: 10,
                    value: false,
                    name: '卡拉卡'
                }];
            this.state.data.platform = [
                {
                    name: 'wechat',
                    value: true,
                    src: '/images/wechatpay.svg'
                },
                {
                    name: 'ali',
                    value: false,
                    src: '/images/alipay.svg'
                }
            ];
            var _this = this;
            var data = this.state.data;
            return ~init;
        }
    });
    if(typeof ReactDOM != "undefined") {
        ReactDOM.render(<PageComponent data={storage}/>, document.getElementById('container'));
    }
    module.exports = PageComponent;
});